package com.qutan.app.core.common;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by pwy on 16/5/15
 * 分页类
 */
@JsonIgnoreProperties(value = {"offset"})
public class Page<T> {
    public List<T> result = new ArrayList<>();
    public long totalCount = 0;
    public Integer pageNo = 0;
    public Integer pageSize = 10;
    public Integer offset = 0;

    public Page() {

    }

    public Page(Integer pageNo, Integer pageSize) {
        if (pageNo != null) {
            this.pageNo = pageNo;
        }
        if (pageSize != null) {
            this.pageSize = pageSize;
        }
        if (this.pageNo.intValue() > 0) {
            this.offset = this.pageSize * this.pageNo;
        }
    }

}
